<?php
/**
 * appRain v 0.1.x
 *
 * LICENSE
 *
 * This source file is subject to the MIT license that is bundled
 * with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://www.opensource.org/licenses/mit-license.php
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@apprain.com so we can send you a copy immediately.
 *
 * @copyright  Copyright (c) 2010 appRain, Inc. (http://www.apprain.com)
 * @license    http://www.opensource.org/licenses/mit-license.php MIT license
 *
 * HELP
 * 
 * Official Website 
 * http://www.apprain.com/
 *
 * Download Link
 * http://www.apprain.com/download
 *
 * Documents Link
 * http ://www.apprain.com/documents
 */

class Development_Callbacks extends Development_AppCommon
{
    /**
    * Run before render
    */
    public function before_render()
    {
		
    }

    /**
    * Run after render
    */
    public function after_render()
    {
		
    }

	/**
	 * @param string
	 * @param fixedArray
	 */
    protected function before_addon_load($name = NULL, $options = NULL)
    {
        switch( $name)
        {

        }
    }
	
	/**
	 * @param string
	 * @param fixedArray
	 */
    protected function after_addon_load($name = NULL, $options = NULL)
    {
        switch( $name)
        {
            case "rich_text_editor" :
                                       if( $this->get_config('rich_text_editor') == 'Yes')
                                        { 
											$rich_text_editor_mode = $this->get_config('rich_text_editor_mode');		
                                        	$rich_text_editor_mode = isset($rich_text_editor_mode) ? $rich_text_editor_mode : "Simple";
                                            $tool_bar_btns = "";
                                            
                                            if( $rich_text_editor_mode == 'Simple' )
                                            {
                                                $tool_bar_btns = ", toolbar :
                                                                    [
                                                                        ['Source'],['Maximize'],['Styles','Format','Font','FontSize'],['TextColor','BGColor'],
                                                                        '/',
                                                                        ['Bold','Italic','Underline','Strike','-','Subscript','Superscript'],
                                                                        ['NumberedList','BulletedList'],['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'],
                                                                        ['Link','Unlink','Anchor'],['Image','Table','Smiley','SpecialChar','SpellChecker']
                                                                    ]";
                                             }

                                            echo "<script type=\"text/javascript\">
                                                //<![CDATA[
                                                    window.onload = function()
                                                    {
                                                        var arr = document.getElementsByTagName('textarea');
                                                        for(var i = 0; i < arr.length; i++ )
                                                        {
                                                           if( arr[i].className.match('richtexteditor'))
                                                           {
                                                                CKEDITOR.replace(arr[i], {
                                                                    extraPlugins : 'uicolor',
                                                                    uiColor: '#D9E5EE'
                                                                    {$tool_bar_btns}
                                                                });
                                                            }
                                                        }
                                                    }
                                                 //]]>
                                                </script>";
                                        }
                                        break;
        }
    }

    /**
    * Information Set call back function. 
    * Run when we view information set
    *
    * @param fixedArray
    */
    protected function on_information_set_view($options = NULL)
    {
        switch( $options['type'])
        {

        }
    }

    /**
    * Information Set call back function. 
    * Run when we delete information set
    *
    * @param fixedArray
    */
    protected function on_information_set_delete($options = NULL)
    {
        switch( $options['type'])
        {

        }
    }

    /**
    * Information Set call back function. 
    * Run when before information set save
	*
    * @param fixedArray
    */
    protected function before_information_set_save($options = NULL)
    {
        switch( $options['type'])
        {

        }
    }

    /**
    * Information Set call back function. 
    * Run when after information set save
    *
    * @param fixedArray
    */
    protected function after_information_set_save($options = NULL)
    {
        switch( $options['type'])
        {
		
        }
    }
	
	/**
	 * Debug hints
	 * pre($send->searchPool)
	 * pre($send->getSearchstring());
	 * pre($send->getLimit());
	 * pre($send->getGroupnames());
	 */
	public function _before_search_init($send = NULL)
	{
		
	}
	
	/**
	 * This function fire once auto search initialization complete
	 */
	public function _after_search_init($send = NULL)
	{
		
	}
}
